package org.ee;

import org.ee.server.NettyServer;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * TCP启动
 */
@SpringBootApplication
public class TcpApplication implements CommandLineRunner {

    private final NettyServer nettyServer;

    public TcpApplication(NettyServer nettyServer) {
        this.nettyServer = nettyServer;
    }

    public static void main(String[] args) {
        SpringApplication.run(TcpApplication.class);

    }

    @Value("${server.port}")
    private Integer port;

    @Override
    public void run(String... args) throws Exception {
        nettyServer.start(port);
    }
}
